<%@ page isELIgnored="false" contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登陆</title>
    <script type="text/javascript" src="/js/jquery.min.js"></script>

    <script>
        function login() {

            var username = $("#username").val();
            var password = $("#password").val();
                // 发送ajax请求
                $.ajax({
                    url: '/user/login?username='+username + '&password=' +password,
                    type: 'GET',
                    dataType: 'json',
                    success: function (data) {
                        if (data.message == "sucess"){
                            alert("登陆成功");
                            window.location.href = "http://localhost:8080/resume/findAll"
                        }else {
                            alert("用户名或密码错误！");
                        }
                    },

                    error: function (data) {
                        alert("登陆失败！")
                    }
                })
        }

    </script>

    <style>
        div{
            padding:10px 10px 0 10px;
        }
    </style>
</head>
<body>

<div align="center">
    <h1 align="center">登陆</h1>
    <fieldset>
        <form >
            <td>账号：</td>
            <input type="text" id="username"/>
            <br><br>
            <td>密码：</td>
            <input type="text" id="password"/>
            <br><br>
            <input type="button" value="登陆" onclick="login()"/>
        </form>
    </fieldset>
</div>
</body>
</html>
